package net.csdra.user.domain;

import net.csdra.basis.domain.CJpaRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by msf on 2018/1/24.
 */
public interface UserRepository extends CJpaRepository<User, String> {
    User findByUserNameAndPassword(String userName, String password);

    User findByUserNameAndTemporaryPwd(String userName, String temporaryPwd);

    @Query("select u from User u where u.authoritys=?1 and u.deleted=false")
    Page<User> findByAuthoritys(List<String> authoritys, Pageable pageable);

    Page<User> findByMetaIdAndAuthoritys(String metaId, String authoritys, Pageable pageable);

}
